<template>
  <div>
    <g-search></g-search>
    <div class="nav">
      <a href>综合排序</a>
      <a href>消量</a>
      <a href>价格</a>
      <a href>好评度</a>
      <a href>店铺</a>
      <a href>筛选</a>
    </div>

    <div class="list">
      <router-link :to="'/detail?id='+item.id" class="item" v-for="item in arr" :key="item.id">
      <img :src="$pre+item.img" alt="">
        <p>{{item.goodsname}}</p>
        <p>{{item.price}}</p>
        <p>{{item.market_price}}</p>
      </router-link>
    </div>
  </div>
</template>

<script>
import { reqFirstCateGood } from "../../http/api";
export default {
  data() {
    return {
      arr: [],
    };
  },
  mounted() {
    reqFirstCateGood({
      cateid: this.$route.query.id,
      type: this.$route.query.type,
    }).then((res) => {
      this.arr=res.data.list.goodData?res.data.list.goodData:[]
    });
  },
};
</script>

<style scoped>
.nav {
  font-size: 0.3rem;
  color: white;
  display: flex;
  height: 0.6rem;
  line-height: 0.6rem;
  background: tomato;
}
.nav a {
  flex: 1;
  text-align: center;
  color: white;
}
.list {
  font-size: 0.45rem;
}
.list img{
  width: 4rem;
  height: 4rem;
}
.list p {
  margin-bottom: 0.3rem;
}
.list .item {
  display: block;
  background: skyblue;
}
.list .item img{
  width: 2rem;
  height: 2rem;
}
.item .title span {
  background: tomato;
}
</style>